package cn.good.yan.basics.t1;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * 1. 配置类
 *      自定义配置 - 注解版  @Value
 * @author shengren.yan
 * @create 2022-11-24
 */
@Component
public class Con4 {

    // 直接获取值
    @Value("${person.userName}")
    private String userName;

    // 获取配置文件里的值，通过 ${}
    @Value("${person.birth}")
    private Date birth;

    // 可以通过表达式 - 计算出来  值：20
    @Value("#{10*2}")
    private Integer age;

    // 直接赋值
    @Value("99")
    private Integer age2;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getAge2() {
        return age2;
    }

    public void setAge2(Integer age2) {
        this.age2 = age2;
    }

}
